-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RELINE_TEST_ENCODING #743
Conversation
cfbb405
to
c7ed7ae
Compare
ee686fa
to
41f1e2d
Compare
41f1e2d
to
6abce8d
Compare
It was not working because it was not environment variable.
8075470
to
a3026b1
Compare
lib/reline/line_editor.rb
Outdated
raise Encoding::CompatibilityError, "incompatible character encodings: #{target.encoding} and #{item.encoding}" | ||
end | ||
|
||
next item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to just use next
and reject encoding incompatible completion candidates
or use next true
to accept it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed it. I decided to use next true
since next
caused the tests to fail.
test/reline/helper.rb
Outdated
def test_mode(ansi: false) | ||
@original_iogate = IOGate | ||
|
||
if ENV['RELINE_TEST_ENCODING'] | ||
encoding = Encoding.find(ENV['RELINE_TEST_ENCODING']) | ||
if Reline.const_defined?(:RELINE_TEST_ENCODING) && RELINE_TEST_ENCODING.is_a?(Encoding) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RELINE_TEST_ENCODING is a top level constant. If it is defined, the value is always an Encoding.
I think one of these is better
if Object.const_defined?(:RELINE_TEST_ENCODING)
if defined?(RELINE_TEST_ENCODING)
Error: test_completion_append_character(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:948:in 'Reline::KeyActor::EmacsTest#test_completion_append_character' =============================================================================== =============================================================================== Error: test_continuous_completion_disabled_with_perfect_match(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:936:in 'Reline::KeyActor::EmacsTest#test_continuous_completion_disabled_with_perfect_match' =============================================================================== =============================================================================== Error: test_continuous_completion_with_perfect_match(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:924:in 'Reline::KeyActor::EmacsTest#test_continuous_completion_with_perfect_match' =============================================================================== Finished in 2.118582151 seconds. 385 tests, 1762 assertions, 0 failures, 3 errors, 0 pendings, 3 omissions, 0 notifications
a3026b1
to
0136ccf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
(ruby/reline#743) * Fix RELINE_TEST_ENCODING It was not working because it was not environment variable. * Fix Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 Error: test_completion_append_character(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:948:in 'Reline::KeyActor::EmacsTest#test_completion_append_character' =============================================================================== =============================================================================== Error: test_continuous_completion_disabled_with_perfect_match(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:936:in 'Reline::KeyActor::EmacsTest#test_continuous_completion_disabled_with_perfect_match' =============================================================================== =============================================================================== Error: test_continuous_completion_with_perfect_match(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:924:in 'Reline::KeyActor::EmacsTest#test_continuous_completion_with_perfect_match' =============================================================================== Finished in 2.118582151 seconds. 385 tests, 1762 assertions, 0 failures, 3 errors, 0 pendings, 3 omissions, 0 notifications ruby/reline@4df825c48f
It was not working because
RELINE_TEST_ENCODING
was not environment variable.